package ru.usu.gv.gui.dynamic;

import org.junit.Assert;
import org.junit.Test;

import ru.usu.gv.utils.StringUtilities;

/**
 * @author spupyrev
 * 07.11.2009
 */
public class TestFormatting
{
	@Test
	public void testDouble()
	{
		double value = 3.14159;

		String s1 = String.format("%.2f", value);
		Assert.assertEquals(s1, "3,14");

		double value2 = 3.0001;
		String s2 = StringUtilities.round2(value2);
		Assert.assertEquals(s2, "3");

		double value3 = 3.12001;
		String s3 = StringUtilities.round2(value3);
		Assert.assertEquals(s3, "3,12");
	}
}
